package org.JWCB.judge.test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

class Solution {
    public List<Integer> reverseList(List<Integer> list) {
        Collections.reverse(list);
        return list;
    }
        public static void main (String[]args){
            String input = args[0];
            String trimmed = input.replaceAll("^\\[|\\]$", "");
            String[] inps = trimmed.split(",");
            List<Integer> inpsList = new ArrayList<>();
            for (int i = 0; i < inps.length; i++) {
                inpsList.add(Integer.valueOf(inps[i]));
            }
            Solution s = new Solution();
            List<Integer> output = s.reverseList(inpsList);
            if (output.isEmpty()) {
                System.out.print("[]");
                return;
            }
            StringBuilder outStr = new StringBuilder();
            outStr.append("[");
            for (int out : output) {
                outStr.append(out).append(",");
            }
            outStr.deleteCharAt(outStr.length() - 1);
            outStr.append("]");
            System.out.print(outStr);
        }
    }


//public class Solution {
//    public boolean isPalindrome(int x) {
//        String s = String.valueOf(x);
//        int left = 0;
//        int right = s.length()-1;
//        while(left <=  right) {
//            if(s.charAt(left) != s.charAt(right)) {
//                return false;
//            }
//            left++;
//            right--;
//        }
//        return true;
//    }
//}